package com.gsbelarus.gedemin.salary.entity.model;

import com.google.gson.annotations.Expose;

import java.io.Serializable;
import java.util.Date;

import io.realm.RealmObject;
import io.realm.annotations.Ignore;
import io.realm.annotations.PrimaryKey;

public class DayEventModel extends RealmObject implements Serializable {

    public enum EventType {DAY_SHIFT, NIGHT_SHIFT, PUBLIC_HOLIDAY, PRIVATE_HOLIDAY, VACATION, CHANGE_WORK_SCHEDULE} // дневная смена, ночная смена, праздник-выходной, отгул, отпуск, изменение рабочего графика   TODO больничный, прогул

    @Ignore
    private EventType eventType;  // hack

    @Expose
    private int eventTypeIndex;

    @PrimaryKey
    @Expose
    private String uid;

    @Ignore
    @Expose
    private String workScheduleKey;

    private Date timeBegin;
    private Date timeEnd;

    @Ignore
    @Expose
    private double hours;

    @Expose
    private String description;
    @Expose
    private boolean isAllDay;

    public EventType getEventType() {
        return EventType.values()[getEventTypeIndex()];
    }

    public void setEventType(EventType eventType) {
        setEventTypeIndex(eventType.ordinal());
    }

    // generated getters & setters

    public String getWorkScheduleKey() {
        return workScheduleKey;
    }

    public void setWorkScheduleKey(String workScheduleKey) {
        this.workScheduleKey = workScheduleKey;
    }

    public int getEventTypeIndex() {
        return eventTypeIndex;
    }

    public void setEventTypeIndex(int eventTypeIndex) {
        this.eventTypeIndex = eventTypeIndex;
    }

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public Date getTimeBegin() {
        return timeBegin;
    }

    public void setTimeBegin(Date timeBegin) {
        this.timeBegin = timeBegin;
    }

    public Date getTimeEnd() {
        return timeEnd;
    }

    public void setTimeEnd(Date timeEnd) {
        this.timeEnd = timeEnd;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public boolean isAllDay() {
        return isAllDay;
    }

    public void setAllDay(boolean isAllDay) {
        this.isAllDay = isAllDay;
    }

    public double getHours() {
        return hours;
    }

    public void setHours(double hours) {
        this.hours = hours;
    }
}
